/**
 * 用户信息
 */
export type IUserInfoVo = {
  nickname: string
  avatarUrl: string
  gender: boolean
  province: string
  city: string
  country: string
  email: string
  platform: string
  openId: string
  unionId: string
  // 添加前端需要的字段
  token: string
  // 可选添加ID字段（如果后端返回）
  id?: number | string
}

export type ICheckUserToken = {
  token: string
  platform: string
}

/**
 * 登录返回的信息
 */
export type IUserLogin = {
  userInfo: IUserInfoVo
  token: string
}

/**
 * 获取验证码
 */
export type ICaptcha = {
  captchaEnabled: boolean
  uuid: string
  image: string
}
/**
 * 上传成功的信息
 */
export type IUploadSuccessInfo = {
  fileId: number
  originalName: string
  fileName: string
  storagePath: string
  fileHash: string
  fileType: string
  fileBusinessType: string
  fileSize: number
}
/**
 * 更新用户信息
 */
export type IUpdateInfo = {
  id: string | number
  nickname: string // 有默认值但保持必需属性
  avatarUrl?: string | null
  gender?: boolean | null
  province?: string | null
  city?: string | null
  country?: string | null
  email?: string | null
  platform?: string | 'WX'
}
/**
 * 更新用户信息
 */
export type IUpdatePassword = {
  id: number
  oldPassword: string
  newPassword: string
  confirmPassword: string
}

export interface AreaNode {
  code: string
  name: string
  children?: AreaNode[]
}

export interface IUpdateUserAvatar {
  id: string | number
  avatarUrl: string
}

export interface IUploadFileRes {
  url: string
  mimeType?: string
  originalName?: string
  size?: number
  path?: string
}

import areaData from '@/static/data/pca-code.json'

export const areas: AreaNode[] = areaData as AreaNode[]
